package com.ruoyi.system.service.impl;
import com.ruoyi.system.entity.PreventionSecurityRiskRefresh;
import com.ruoyi.system.mapper.PreventionSecurityRiskRefreshMapper;
import com.ruoyi.system.service.PreventionSecurityRiskRefreshService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * 双重预防-风险分析清单明细_刷新任务表(PreventionSecurityRiskRefresh)表服务实现类
 * @since 2023-05-08 14:19:01
 */
@Service("preventionSecurityRiskRefreshService")
public class PreventionSecurityRiskRefreshServiceImpl implements PreventionSecurityRiskRefreshService {
    @Resource
    private PreventionSecurityRiskRefreshMapper preventionSecurityRiskRefreshDao;

    /**
     * 通过ID查询单条数据
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PreventionSecurityRiskRefresh queryById(Integer id) {
        return this.preventionSecurityRiskRefreshDao.queryById(id);
    }

    /**
     * 分页查询
     * @return 查询结果
     */
    @Override
    public List<PreventionSecurityRiskRefresh> queryByPage(PreventionSecurityRiskRefresh preventionSecurityRiskRefresh) {
        return preventionSecurityRiskRefreshDao.queryAllByLimit(preventionSecurityRiskRefresh);
    }


    /**
     * 新增数据
     * @return 实例对象
     */
    @Override
    public PreventionSecurityRiskRefresh insert(PreventionSecurityRiskRefresh preventionSecurityRiskRefresh) {
        this.preventionSecurityRiskRefreshDao.insert(preventionSecurityRiskRefresh);
        return preventionSecurityRiskRefresh;
    }

    /**
     * 修改数据
     * @return 实例对象
     */
    @Override
    public PreventionSecurityRiskRefresh update(PreventionSecurityRiskRefresh preventionSecurityRiskRefresh) {
        this.preventionSecurityRiskRefreshDao.update(preventionSecurityRiskRefresh);
        return this.queryById(preventionSecurityRiskRefresh.getId());
    }

    /**
     * 通过主键删除数据
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.preventionSecurityRiskRefreshDao.deleteById(id) > 0;
    }
}
